package com.samuel.learning.design.pattern.builder;

public class Goods2 {

    private Integer id;
    private Double  price;

    @Override
    public String toString() {
        return "Goods{" +
                "id=" + id +
                ", price=" + price +
                '}';
    }

    private Goods2(Goods2 target) {
        this.id = target.id;
        this.price = target.price;
    }

    private Goods2() {
    }

    public static class Builder {
         private Goods2 target;

         public Builder(){
             target = new Goods2();
        }

        public Builder id(Integer id){
            target.id = id;
            return this;
        }

        public Builder price(Double price){
            target.price = price;
            return this;
        }

        public Goods2 build(){
             return new Goods2(target);
        }


    }


}

